<?php

namespace app\admin\model\device;

use think\Model;

class DeviceModel extends Model
{
    // 表名
    protected $name = 'device_model';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    const DELETE_TIME = 0;

    // 追加属性
    protected $append = [

    ];

    /**
     * 检查数据是否存在
     * @param $id
     * @return false|mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function checkIsExist($id)
    {
        $info = $this->field('id')
            ->where('id', $id)
            ->where('deletetime', self::DELETE_TIME)
            ->find();
        if (!$info) {
            return false;
        }
        return $info['id'];
    }
    







}
